<div>
	<h2 style="padding-bottom: 15px;">Bài viết mới nhất</h2>
<?php
	foreach ($posts as $post) {
		echo '<div class="listpost">';
		echo '<h2>'.$this->Html->link($post['Post']['title'], array('controller'=>'posts', 'action'=>'view', $post['Post']['id'])).'</h2>';
        echo '<p><small>Create at: '.$post['Post']['created'].'</small></p>';
        echo '<p class="truncate-content">'.$this->Text->truncate($post['Post']['body'],300,array('ending'=>' ...','exact'=>false,'html' => true)).'</p>';
        echo '<p style="text-align: right;">'.$this->Html->link('>> Read More ...', array('controller'=>'posts', 'action'=>'view', $post['Post']['id'])).'</p>';
        // echo '<p>Content: '.$post['Post']['body'].'</p>';   
      echo '</div>  ';
	}
	// unset($post);
?>

<?php
	echo '<div class="paginate">';
	echo $this->Paginator->first('Frst page');//di den trang dau tien
	echo '&nbsp&nbsp&nbsp'.$this->Paginator->prev('« Previous ', null, null, array('class' => 'disabled')); //Shows the next and previous links
	echo " | ".$this->Paginator->numbers()." | "; //Shows the page numbers
	echo $this->Paginator->next(' Next »', null, null, array('class' => 'disabled')); //Shows the next and previous links
	echo " Page ".$this->Paginator->counter().'&nbsp'; // prints X of Y, where X is current page and Y is number of pages
	echo $this->Paginator->last('... Last page');//di den trang cuoi cung
	echo '</div></div>';
?>